package com.woniuxy.exam.controller;

import com.woniuxy.exam.entity.Users;
import com.woniuxy.exam.service.IUsersService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.cache.annotation.Cacheable;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

/**
 * <p>
 *  前端控制器
 * </p>
 *
 * @author Lzj
 * @since 2023-10-31
 */
@RestController
@RequestMapping("/users")
public class UsersController {

    @Autowired
    private IUsersService userService;
    @Cacheable(cacheNames = "users:list")
    @GetMapping("/getUsers")
    public List<Users> getUsers(){
        List<Users> usersList = userService.getAllUsers();
        return usersList;
    }
}
